module ContactsHelper
  def get_customer_full_name contact
        if contact.reference.nil?
           return ""
        else
          if contact.reference_type == 'People'
            return "#{I18n.translate('activerecord.models.people')} - #{contact.reference.last_name}, #{contact.reference.first_name}"
          end
          if contact.reference_type == 'Institute'
            return "#{I18n.translate('activerecord.models.institute')} - #{contact.reference.name}"
          end
          if contact.reference_type == 'Library'
            return "#{I18n.translate('activerecord.models.institute')}: #{contact.reference.institute.name} - #{I18n.translate('activerecord.models.library')}: #{contact.reference.name}"
          end
          if contact.reference_type == 'LibraryDepartment'
            return  "#{I18n.translate('activerecord.models.institute')}: #{contact.reference.library.institute.name} - #{I18n.translate('activerecord.models.library')}: #{contact.reference.library.name} - #{I18n.translate('activerecord.models.library_department')}: #{contact.reference.name}"
          end
          if contact.reference_type == 'Bookshop'
            return "#{I18n.translate('activerecord.models.bookshop')} - #{contact.reference.name}"
          end
          if contact.reference_type == 'BookshopDepartment'
            return "#{I18n.translate('activerecord.models.bookshop')}: #{contact.reference.bookshop.name} - #{I18n.translate('activerecord.models.bookshop_department')}: #{contact.reference.name}"
          end
          if contact.reference_type == 'Publisher'
            return "#{I18n.translate('activerecord.models.publisher')} - #{contact.reference.name}"
          end
        end

  end

end